diff options
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 25 | ||||
-rw-r--r-- | sw/source/uibase/config/viewopt.cxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
3 files changed, 27 insertions, 3 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 19bd70fa78e4..06b9ee25a64c 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1639,10 +1639,11 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testGetViewRenderState) aViewOptions.SetOnlineSpell(true); pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions); } - CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), pXTextDocument->getViewRenderState()); // Create a second view SfxLokHelper::createView(); + int nSecondViewId = SfxLokHelper::getView(); ViewCallback aView2; { // Give the second view different options @@ -1651,11 +1652,29 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testGetViewRenderState) aViewOptions.SetOnlineSpell(true); pXTextDocument->GetDocShell()->GetWrtShell()->ApplyViewOptions(aViewOptions); } - CPPUNIT_ASSERT_EQUAL(OString("S"), pXTextDocument->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(OString("S;Default"), pXTextDocument->getViewRenderState()); // Switch back to the first view, and check that the options string is the same SfxLokHelper::setView(nFirstViewId); - CPPUNIT_ASSERT_EQUAL(OString("PS"), pXTextDocument->getViewRenderState()); + CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), pXTextDocument->getViewRenderState()); + + // Switch back to the second view, and change to dark mode + SfxLokHelper::setView(nSecondViewId); + { + SwDoc* pDoc = pXTextDocument->GetDocShell()->GetDoc(); + SwView* pView = pDoc->GetDocShell()->GetView(); + uno::Reference<frame::XFrame> xFrame = pView->GetViewFrame().GetFrame().GetFrameInterface(); + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence( + { + { "NewTheme", uno::Any(OUString("Dark")) }, + } + ); + comphelper::dispatchCommand(".uno:ChangeTheme", xFrame, aPropertyValues); + } + CPPUNIT_ASSERT_EQUAL(OString("S;Dark"), pXTextDocument->getViewRenderState()); + // Switch back to the first view, and check that the options string is the same + SfxLokHelper::setView(nFirstViewId); + CPPUNIT_ASSERT_EQUAL(OString("PS;Default"), pXTextDocument->getViewRenderState()); } CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testSetViewGraphicSelection) diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 6b9ca4967c36..2f456a317e92 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -237,6 +237,7 @@ void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool b } SwViewOption::SwViewOption() : + m_sThemeName( "Default" ), m_sSymbolFont( "symbol" ), m_aRetouchColor( COL_TRANSPARENT ), mnViewLayoutColumns( 0 ), diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index e7eb52e81a21..f107586c1a29 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3414,6 +3414,10 @@ OString SwXTextDocument::getViewRenderState() aState.append('P'); if (pVOpt->IsOnlineSpell()) aState.append('S'); + aState.append(';'); + + OString aThemeName = OUStringToOString(pVOpt->GetThemeName(), RTL_TEXTENCODING_UTF8); + aState.append(aThemeName); } } return aState.makeStringAndClear(); |