implement the style pane right toolbar the same as the left toolbar

Change-Id: I1a031facad52afbc84b06610f9bdd0a9f118ebeb
This commit is contained in:
Caolán McNamara
2016-01-08 10:53:34 +00:00
parent 0157524427
commit 0b14725c7b
3 changed files with 54 additions and 74 deletions

View File

@@ -50,7 +50,6 @@
#include <sfx2/tplpitem.hxx>
#include <sfx2/sfxresid.hxx>
#include "templdlg.hrc"
#include <sfx2/sfx.hrc>
#include "dialog.hrc"
#include "arrdecl.hxx"
@@ -2200,13 +2199,65 @@ std::unique_ptr<PopupMenu> SfxCommonTemplateDialog_Impl::CreateContextMenu()
return pMenu;
}
static OUString lcl_GetLabel(uno::Any& rAny)
{
OUString sRet;
uno::Sequence< beans::PropertyValue >aPropSeq;
if ( rAny >>= aPropSeq )
{
for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
{
if ( aPropSeq[i].Name == "Label" )
{
aPropSeq[i].Value >>= sRet;
break;
}
}
}
return sRet;
}
SfxTemplateDialog_Impl::SfxTemplateDialog_Impl(SfxBindings* pB, SfxTemplatePanelControl* pDlgWindow)
: SfxCommonTemplateDialog_Impl(pB, pDlgWindow, true)
, m_pFloat(pDlgWindow)
, m_bZoomIn(false)
, m_aActionTbL(VclPtrInstance<DropToolBox_Impl>(pDlgWindow, this))
, m_aActionTbR(VclPtrInstance<ToolBox> (pDlgWindow, SfxResId(TB_ACTION)))
, m_aActionTbR(VclPtrInstance<ToolBox>(pDlgWindow))
{
try
{
uno::Reference< container::XNameAccess > xNameAccess(
frame::theUICommandDescription::get(
::comphelper::getProcessComponentContext()) );
uno::Reference< container::XNameAccess > xUICommands;
OUString sTextDoc("com.sun.star.text.TextDocument");
if(xNameAccess->hasByName(sTextDoc))
{
uno::Any a = xNameAccess->getByName( sTextDoc );
a >>= xUICommands;
}
if (xUICommands.is())
{
uno::Any aCommand = xUICommands->getByName(".uno:StyleApply");
OUString sLabel = lcl_GetLabel( aCommand );
m_aActionTbR->InsertItem( SID_STYLE_WATERCAN, sLabel );
m_aActionTbR->SetHelpId(SID_STYLE_WATERCAN, HID_TEMPLDLG_WATERCAN);
aCommand = xUICommands->getByName(".uno:StyleNewByExample");
sLabel = lcl_GetLabel( aCommand );
m_aActionTbR->InsertItem( SID_STYLE_NEW_BY_EXAMPLE, sLabel );
m_aActionTbR->SetHelpId(SID_STYLE_NEW_BY_EXAMPLE, HID_TEMPLDLG_NEWBYEXAMPLE);
aCommand = xUICommands->getByName(".uno:StyleUpdateByExample");
sLabel = lcl_GetLabel( aCommand );
m_aActionTbR->InsertItem( SID_STYLE_UPDATE_BY_EXAMPLE, sLabel );
m_aActionTbR->SetHelpId(SID_STYLE_UPDATE_BY_EXAMPLE, HID_TEMPLDLG_UPDATEBYEXAMPLE);
}
}
catch (const uno::Exception&)
{
}
pDlgWindow->FreeResource();
Initialize();
}
@@ -2443,24 +2494,6 @@ IMPL_LINK_TYPED( SfxTemplateDialog_Impl, ToolBoxLSelect, ToolBox *, pBox, void )
FamilySelect(nEntry);
}
static OUString lcl_GetLabel(uno::Any& rAny)
{
OUString sRet;
uno::Sequence< beans::PropertyValue >aPropSeq;
if ( rAny >>= aPropSeq )
{
for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
{
if ( aPropSeq[i].Name == "Label" )
{
aPropSeq[i].Value >>= sRet;
break;
}
}
}
return sRet;
}
IMPL_LINK_TYPED( SfxTemplateDialog_Impl, ToolBoxRSelect, ToolBox *, pBox, void )
{
const sal_uInt16 nEntry = pBox->GetCurItemId();
@@ -2513,7 +2546,7 @@ IMPL_LINK_TYPED( SfxTemplateDialog_Impl, ToolBoxRClick, ToolBox *, pBox, void )
PopupMenuFlags::ExecuteDown );
pBox->EndSelection();
}
catch(uno::Exception&)
catch (const uno::Exception&)
{
}
pBox->Invalidate();

View File

@@ -1,21 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#define TB_ACTION 15
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -19,7 +19,6 @@
#include <sfx2/sfx.hrc>
#include "dialog.hrc"
#include "templdlg.hrc"
#include "helpid.hrc"
ImageList DLG_STYLE_DESIGNER
@@ -49,8 +48,6 @@ String STR_STYLE_FILTER_HIERARCHICAL
// DLG_STYLE_DESIGNER ----------------------------------------------------
DockingWindow DLG_STYLE_DESIGNER
{
Text [ en-US ] = "Styles and Formatting" ;
HelpId = CMD_SID_STYLE_DESIGNER ;
OutputSize = TRUE ;
Hide = TRUE ;
@@ -64,35 +61,6 @@ DockingWindow DLG_STYLE_DESIGNER
EnableResizing = TRUE ;
Border = TRUE ;
Moveable = TRUE ;
ToolBox TB_ACTION
{
Pos = MAP_APPFONT ( 3 , 3 ) ;
Size = MAP_APPFONT ( 57 , 42 ) ;
LineCount = 1 ;
ItemImageList = DLG_STYLE_DESIGNER ;
HelpId = HID_TEMPLDLG_TOOLBOX_RIGHT ;
ItemList =
{
ToolBoxItem
{
HelpId = HID_TEMPLDLG_WATERCAN ;
Identifier = SID_STYLE_WATERCAN ;
Text [ en-US ] = "Fill Format Mode" ;
};
ToolBoxItem
{
HelpId = HID_TEMPLDLG_NEWBYEXAMPLE ;
Identifier = SID_STYLE_NEW_BY_EXAMPLE ;
Text [ en-US ] = "New Style from Selection" ;
};
ToolBoxItem
{
HelpId = HID_TEMPLDLG_UPDATEBYEXAMPLE ;
Identifier = SID_STYLE_UPDATE_BY_EXAMPLE ;
Text [ en-US ] = "Update Style" ;
};
};
};
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */