include/sfx2/classificationhelper.hxx | 2 officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu | 4 - sfx2/source/view/classificationcontroller.cxx | 7 ++ sfx2/source/view/classificationhelper.cxx | 29 ++++++---- 4 files changed, 29 insertions(+), 13 deletions(-)
New commits: commit 92978fc5a8eeb5b3de6167f9f7eb215970bb3e34 Author: Miklos Vajna <[email protected]> Date: Mon Feb 29 16:59:11 2016 +0100 officecfg: move classificationbar up, so dropdown has enough space It used to display categories above the control, due to lack of space. Change-Id: I3d02e57ec55d1ec17d5f43f0cddc2c80cb9c9acb diff --git a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu index 576ebc0..5cdb74b 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/WriterWindowState.xcu @@ -173,10 +173,10 @@ </node> <node oor:name="private:resource/toolbar/classificationbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> - <value>0,0</value> + <value>0,2</value> </prop> <prop oor:name="DockingArea" oor:type="xs:int"> - <value>1</value> + <value>0</value> </prop> <prop oor:name="Docked" oor:type="xs:boolean"> <value>true</value> commit f2ad799bdef9056794e60c8bc00b1d25f6bd776a Author: Miklos Vajna <[email protected]> Date: Mon Feb 29 16:01:39 2016 +0100 sfx2 classification: fix initial toolbar control size When the toolbar control is first shown, we don't have an object shell yet, so can't insert items to the listbox. Set the same initial size as SvxFontNameBox_Impl has, should be good enough for us, too. Change-Id: I12cc72d26353ec3a4d2d3fc5c72f3171c276d3dc diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index 737eefd..b05431c 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -103,6 +103,8 @@ uno::Reference<awt::XWindow> ClassificationCategoriesController::createItemWindo { m_pCategories = VclPtr<ListBox>::Create(pToolbar, WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_DROPDOWN|WB_SIMPLEMODE); m_pCategories->SetSelectHdl(LINK(this, ClassificationCategoriesController, SelectHdl)); + // Same as SvxFontNameBox_Impl. + m_pCategories->SetSizePixel(m_pCategories->LogicToPixel(Size(60, 160), MAP_APPFONT)); } return uno::Reference<awt::XWindow>(VCLUnoHelper::GetInterface(m_pCategories)); commit 78f2b0b364930493085f4ee9bafb90c2536d6ae6 Author: Miklos Vajna <[email protected]> Date: Mon Feb 29 14:57:45 2016 +0100 sfx2 classification: set initial listbox state based on doc model This way the listbox selections shows the state of the document model, instead of showing an empty selection by default, as it is for empty, non-classified documents. Change-Id: Ibda0565e3ca9ec6611d8e256a78747437b52c42a diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index 0e861a1..737eefd 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -134,6 +134,11 @@ void ClassificationCategoriesController::statusChanged(const frame::FeatureState // Normally VclBuilder::makeObject() does this. m_pCategories->EnableAutoSize(true); m_pCategories->SetSizePixel(m_pCategories->GetOptimalSize()); + + // Restore state based on the doc. model. + const OUString& rCategoryName = aHelper.GetBACName(); + if (!rCategoryName.isEmpty()) + m_pCategories->SelectEntry(rCategoryName); } } // namespace sfx2 commit 98f7e70aeb5c445a04a45cebce7553cb23d57e65 Author: Miklos Vajna <[email protected]> Date: Mon Feb 29 14:44:53 2016 +0100 sfx2 classification: fix category name duplication A category name was stored in m_aName and also as a label value with key name PROP_BACNAME(). Fix this by always using m_aName, and doing the conversion in both directions in SfxClassificationHelper::Impl::pushToObjectShell() and the SfxClassificationHelper() ctor, as document metadata wants to work with only key-vaulue pairs. Change-Id: Iad386840038966e4483e3503c5fcdc046ca9effc diff --git a/include/sfx2/classificationhelper.hxx b/include/sfx2/classificationhelper.hxx index cad0eaf6..5b007020 100644 --- a/include/sfx2/classificationhelper.hxx +++ b/include/sfx2/classificationhelper.hxx @@ -35,7 +35,7 @@ public: SfxClassificationHelper(SfxObjectShell& rObjectShell); ~SfxClassificationHelper(); - OUString GetBACName(); + const OUString& GetBACName(); /// Return all possible valid category names, based on the policy. std::vector<OUString> GetBACNames(); /// Setting this sets all the other properties, based on the policy. diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index f8d7335..8fc5190 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -40,6 +40,7 @@ namespace class SfxClassificationCategory { public: + /// PROP_BACNAME() is stored separately for easier lookup. OUString m_aName; std::map<OUString, OUString> m_aLabels; }; @@ -147,7 +148,6 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception) rCategory.m_aLabels["urn:bails:IntellectualProperty:Policy:Name"] = m_aPolicyName; rCategory.m_aLabels["urn:bails:IntellectualProperty:BusinessAuthorization:Identifier"] = m_aProgramID; rCategory.m_aLabels["urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Identifier"] = aIdentifier; - rCategory.m_aLabels["urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name"] = aName; // Also initialize defaults. rCategory.m_aLabels["urn:bails:IntellectualProperty:PolicyAuthority:Identifier"] = "None"; @@ -279,6 +279,12 @@ void SAL_CALL SfxClassificationParser::setDocumentLocator(const uno::Reference<x { } +const OUString& PROP_BACNAME() +{ + static OUString sProp("urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name"); + return sProp; +} + } // anonymous namespace /// Implementation details of SfxClassificationHelper. @@ -339,7 +345,9 @@ void SfxClassificationHelper::Impl::pushToObjectShell() uno::Reference<beans::XPropertyContainer> xPropertyContainer = xDocumentProperties->getUserDefinedProperties(); uno::Reference<beans::XPropertySet> xPropertySet(xPropertyContainer, uno::UNO_QUERY); uno::Sequence<beans::Property> aProperties = xPropertySet->getPropertySetInfo()->getProperties(); - for (const std::pair<OUString, OUString>& rLabel : m_aCategory.m_aLabels) + std::map<OUString, OUString> aLabels = m_aCategory.m_aLabels; + aLabels[PROP_BACNAME()] = m_aCategory.m_aName; + for (const std::pair<OUString, OUString>& rLabel : aLabels) { try { @@ -391,7 +399,12 @@ SfxClassificationHelper::SfxClassificationHelper(SfxObjectShell& rObjectShell) uno::Any aAny = xPropertySet->getPropertyValue(rProperty.Name); OUString aValue; if (aAny >>= aValue) - m_pImpl->m_aCategory.m_aLabels[rProperty.Name] = aValue; + { + if (rProperty.Name == PROP_BACNAME()) + m_pImpl->m_aCategory.m_aName = aValue; + else + m_pImpl->m_aCategory.m_aLabels[rProperty.Name] = aValue; + } } } @@ -399,13 +412,9 @@ SfxClassificationHelper::~SfxClassificationHelper() { } -OUString SfxClassificationHelper::GetBACName() +const OUString& SfxClassificationHelper::GetBACName() { - std::map<OUString, OUString>::iterator it = m_pImpl->m_aCategory.m_aLabels.find("urn:bails:IntellectualProperty:BusinessAuthorizationCategory:Name"); - if (it != m_pImpl->m_aCategory.m_aLabels.end()) - return it->second; - - return OUString(); + return m_pImpl->m_aCategory.m_aName; } bool SfxClassificationHelper::HasImpactLevel() @@ -526,7 +535,7 @@ void SfxClassificationHelper::SetBACName(const OUString& rName) return; } - m_pImpl->m_aCategory.m_aLabels = it->m_aLabels; + m_pImpl->m_aCategory = *it; m_pImpl->pushToObjectShell(); SfxViewFrame* pViewFrame = SfxViewFrame::Current(); if (!pViewFrame) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
