sw/qa/extras/ww8export/data/zoom.doc |binary sw/qa/extras/ww8export/ww8export.cxx | 13 +++++++++++++ sw/source/filter/ww8/wrtww8.cxx | 5 +++++ sw/source/filter/ww8/ww8par.cxx | 21 +++++++++++++++++++++ sw/source/filter/ww8/ww8scan.hxx | 2 +- 5 files changed, 40 insertions(+), 1 deletion(-)
New commits: commit 322d9ca5b0545ec1ae5ac5e3b704e4ba99b68e22 Author: Miklos Vajna <[email protected]> Date: Mon Jan 7 09:14:32 2013 +0100 WW8 filter: zoom factor testcase Change-Id: I89944f0a242174cc4b3c1fcf4f3f2fe744287ee3 diff --git a/sw/qa/extras/ww8export/data/zoom.doc b/sw/qa/extras/ww8export/data/zoom.doc new file mode 100644 index 0000000..7054896 Binary files /dev/null and b/sw/qa/extras/ww8export/data/zoom.doc differ diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 963bf75..f7a8f04 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <swmodeltestbase.hxx> @@ -40,6 +41,7 @@ public: void testFdo45724(); void testFdo46020(); void testFirstHeaderFooter(); + void testZoom(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -58,6 +60,7 @@ void Test::run() {"fdo45724.odt", &Test::testFdo45724}, {"fdo46020.odt", &Test::testFdo46020}, {"first-header-footer.doc", &Test::testFirstHeaderFooter}, + {"zoom.doc", &Test::testZoom}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -132,6 +135,16 @@ void Test::testFirstHeaderFooter() CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"), parseDump("/root/page[6]/footer/txt/text()")); } +void Test::testZoom() +{ + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings()); + sal_Int16 nValue = 0; + xPropertySet->getPropertyValue("ZoomValue") >>= nValue; + CPPUNIT_ASSERT_EQUAL(sal_Int16(42), nValue); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit 10d6d0d00735e5c0f31d602ce94502c00d2371d5 Author: Miklos Vajna <[email protected]> Date: Mon Jan 7 09:13:23 2013 +0100 WW8 filter: export zoom factor Change-Id: I5c64d8311439430e3b21a90381ef51a1061bb0b9 diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 7651b40..b89a143 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -55,6 +55,7 @@ #include <fmtrowsplt.hxx> #include <frmatr.hxx> #include <doc.hxx> +#include <viewopt.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -232,6 +233,10 @@ static void WriteDop( WW8Export& rWrt ) DefaultItemGet<SvxTabStopItem>(*rWrt.pDoc, RES_PARATR_TABSTOP); rDop.dxaTab = (sal_uInt16)rTabStop[0].GetTabPos(); + // Zoom factor. + ViewShell *pViewShell(rWrt.pDoc->GetCurrentViewShell()); + if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == SVX_ZOOM_PERCENT) + rDop.wScaleSaved = pViewShell->GetViewOptions()->GetZoom(); // Werte aus der DocStatistik (werden aufjedenfall fuer die // DocStat-Felder benoetigt!) commit 6e9ab7e0ca443cca46cd39a313583f4b90549e1c Author: Miklos Vajna <[email protected]> Date: Mon Jan 7 09:13:02 2013 +0100 WW8 filter: import zoom factor Change-Id: I557cf89642ff618aaddb2f036652d126b25555c9 diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 58970eb..0db2f7f 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -90,6 +90,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XViewDataSupplier.hpp> #include <svl/itemiter.hxx> //SfxItemIter #include <comphelper/processfactory.hxx> @@ -1491,6 +1492,26 @@ void SwWW8ImplReader::ImportDop() rDoc.GetAttrPool().SetPoolDefaultItem( aNewTab ); + // Import zoom factor. + if (pWDop->wScaleSaved) + { + uno::Sequence<beans::PropertyValue> aViewProps(3); + aViewProps[0].Name = "ZoomFactor"; + aViewProps[0].Value <<= sal_Int16(pWDop->wScaleSaved); + aViewProps[1].Name = "VisibleBottom"; + aViewProps[1].Value <<= sal_Int32(0); + aViewProps[2].Name = "ZoomType"; + aViewProps[2].Value <<= sal_Int16(0); + + uno::Reference< uno::XComponentContext > xComponentContext(comphelper::getProcessComponentContext()); + uno::Reference<container::XIndexContainer> xBox(xComponentContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.IndexedPropertyValues", + xComponentContext), uno::UNO_QUERY); + xBox->insertByIndex(sal_Int32(0), uno::makeAny(aViewProps)); + uno::Reference<container::XIndexAccess> xIndexAccess(xBox, uno::UNO_QUERY); + uno::Reference<document::XViewDataSupplier> xViewDataSupplier(mpDocShell->GetModel(), uno::UNO_QUERY); + xViewDataSupplier->setViewData(xIndexAccess); + } + rDoc.set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, !pWDop->fUsePrinterMetrics); rDoc.set(IDocumentSettingAccess::USE_HIRES_VIRTUAL_DEVICE, true); rDoc.set(IDocumentSettingAccess::ADD_FLY_OFFSETS, true ); diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 8f681d8..6913545 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1583,7 +1583,7 @@ public: sal_Int32 cLinesFtnEdn; // count of paragraphs in footnotes and endnotes tallied by last Word Count operation sal_Int32 lKeyProtDoc; // document protection password key, only valid if dop.fProtEnabled, dop.fLockAtn or dop.fLockRev are 1. sal_uInt16 wvkSaved : 3; // document view kind: 0 Normal view, 1 Outline view, 2 Page View - sal_uInt16 wScaleSaved : 9; // + sal_uInt16 wScaleSaved : 9; ///< Specifies the zoom percentage that was in use when the document was saved. sal_uInt16 zkSaved : 2; sal_uInt16 fRotateFontW6 : 1; sal_uInt16 iGutterPos : 1 ; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
