Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d8fc06d2
Kaydet (Commit)
d8fc06d2
authored
Kas 16, 2015
tarafından
Samuel Mehrbrodt
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Move functionality to retrieve command image to CommandInfoProvider
Change-Id: I79c22e0507c5eba8b5e28721de3279131aececc9
üst
40fa8387
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
93 deletions
+78
-93
commandinfoprovider.hxx
include/vcl/commandinfoprovider.hxx
+6
-0
commandinfoprovider.cxx
vcl/source/helper/commandinfoprovider.cxx
+70
-9
builder.cxx
vcl/source/window/builder.cxx
+1
-73
toolbox2.cxx
vcl/source/window/toolbox2.cxx
+1
-11
No files found.
include/vcl/commandinfoprovider.hxx
Dosyayı görüntüle @
d8fc06d2
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <vcl/dllapi.h>
#include <vcl/dllapi.h>
#include <vcl/keycod.hxx>
#include <vcl/keycod.hxx>
#include <vcl/image.hxx>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
...
@@ -78,6 +79,11 @@ public:
...
@@ -78,6 +79,11 @@ public:
OUString
GetCommandShortcut
(
const
OUString
&
rCommandName
,
OUString
GetCommandShortcut
(
const
OUString
&
rCommandName
,
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
);
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
);
Image
GetImageForCommand
(
const
OUString
&
rsCommandName
,
bool
bLarge
,
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
);
/** Do not call. Should be part of a local and hidden interface.
/** Do not call. Should be part of a local and hidden interface.
*/
*/
void
SetFrame
(
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
);
void
SetFrame
(
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
);
...
...
vcl/source/helper/commandinfoprovider.cxx
Dosyayı görüntüle @
d8fc06d2
...
@@ -27,9 +27,10 @@
...
@@ -27,9 +27,10 @@
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/ImageType.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
using
namespace
css
;
using
namespace
css
;
using
namespace
css
::
uno
;
using
namespace
css
::
uno
;
...
@@ -61,7 +62,7 @@ namespace
...
@@ -61,7 +62,7 @@ namespace
mxFrame
->
removeEventListener
(
this
);
mxFrame
->
removeEventListener
(
this
);
}
}
virtual
void
SAL_CALL
disposing
(
const
css
::
lang
::
EventObject
&
rEvent
)
virtual
void
SAL_CALL
disposing
(
const
css
::
lang
::
EventObject
&
rEvent
)
throw
(
css
::
uno
::
RuntimeException
,
std
::
exception
)
override
throw
(
RuntimeException
,
std
::
exception
)
override
{
{
(
void
)
rEvent
;
(
void
)
rEvent
;
mrInfoProvider
.
SetFrame
(
nullptr
);
mrInfoProvider
.
SetFrame
(
nullptr
);
...
@@ -153,6 +154,66 @@ OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
...
@@ -153,6 +154,66 @@ OUString CommandInfoProvider::GetCommandShortcut (const OUString& rsCommandName,
return
OUString
();
return
OUString
();
}
}
Image
CommandInfoProvider
::
GetImageForCommand
(
const
OUString
&
rsCommandName
,
bool
bLarge
,
const
Reference
<
frame
::
XFrame
>&
rxFrame
)
{
SetFrame
(
rxFrame
);
if
(
rsCommandName
.
isEmpty
())
return
Image
();
sal_Int16
nImageType
(
ui
::
ImageType
::
COLOR_NORMAL
|
ui
::
ImageType
::
SIZE_DEFAULT
);
if
(
bLarge
)
nImageType
|=
ui
::
ImageType
::
SIZE_LARGE
;
try
{
Reference
<
frame
::
XController
>
xController
(
rxFrame
->
getController
());
Reference
<
frame
::
XModel
>
xModel
(
xController
->
getModel
());
Reference
<
ui
::
XUIConfigurationManagerSupplier
>
xSupplier
(
xModel
,
UNO_QUERY
);
if
(
xSupplier
.
is
())
{
Reference
<
ui
::
XUIConfigurationManager
>
xDocUICfgMgr
(
xSupplier
->
getUIConfigurationManager
(),
UNO_QUERY
);
Reference
<
ui
::
XImageManager
>
xDocImgMgr
(
xDocUICfgMgr
->
getImageManager
(),
UNO_QUERY
);
Sequence
<
Reference
<
graphic
::
XGraphic
>
>
aGraphicSeq
;
Sequence
<
OUString
>
aImageCmdSeq
{
rsCommandName
};
aGraphicSeq
=
xDocImgMgr
->
getImages
(
nImageType
,
aImageCmdSeq
);
Reference
<
graphic
::
XGraphic
>
xGraphic
=
aGraphicSeq
[
0
];
Image
aImage
(
xGraphic
);
if
(
!!
aImage
)
return
aImage
;
}
}
catch
(
Exception
&
)
{
}
try
{
Reference
<
ui
::
XModuleUIConfigurationManagerSupplier
>
xModuleCfgMgrSupplier
(
ui
::
theModuleUIConfigurationManagerSupplier
::
get
(
mxContext
));
Reference
<
ui
::
XUIConfigurationManager
>
xUICfgMgr
(
xModuleCfgMgrSupplier
->
getUIConfigurationManager
(
GetModuleIdentifier
()));
Sequence
<
Reference
<
graphic
::
XGraphic
>
>
aGraphicSeq
;
Reference
<
ui
::
XImageManager
>
xModuleImageManager
(
xUICfgMgr
->
getImageManager
(),
UNO_QUERY
);
Sequence
<
OUString
>
aImageCmdSeq
{
rsCommandName
};
aGraphicSeq
=
xModuleImageManager
->
getImages
(
nImageType
,
aImageCmdSeq
);
Reference
<
graphic
::
XGraphic
>
xGraphic
(
aGraphicSeq
[
0
]);
return
Image
(
xGraphic
);
}
catch
(
Exception
&
)
{
}
return
Image
();
}
void
CommandInfoProvider
::
SetFrame
(
const
Reference
<
frame
::
XFrame
>&
rxFrame
)
void
CommandInfoProvider
::
SetFrame
(
const
Reference
<
frame
::
XFrame
>&
rxFrame
)
{
{
if
(
rxFrame
!=
mxCachedDataFrame
)
if
(
rxFrame
!=
mxCachedDataFrame
)
...
@@ -262,14 +323,14 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
...
@@ -262,14 +323,14 @@ OUString CommandInfoProvider::RetrieveShortcutsFromConfiguration(
Sequence
<
Any
>
aKeyCodes
(
rxConfiguration
->
getPreferredKeyEventsForCommandList
(
aCommands
));
Sequence
<
Any
>
aKeyCodes
(
rxConfiguration
->
getPreferredKeyEventsForCommandList
(
aCommands
));
if
(
aCommands
.
getLength
()
==
1
)
if
(
aCommands
.
getLength
()
==
1
)
{
{
css
::
awt
::
KeyEvent
aKeyEvent
;
awt
::
KeyEvent
aKeyEvent
;
if
(
aKeyCodes
[
0
]
>>=
aKeyEvent
)
if
(
aKeyCodes
[
0
]
>>=
aKeyEvent
)
{
{
return
AWTKey2VCLKey
(
aKeyEvent
).
GetName
();
return
AWTKey2VCLKey
(
aKeyEvent
).
GetName
();
}
}
}
}
}
}
catch
(
lang
::
IllegalArgumentException
&
)
catch
(
css
::
lang
::
IllegalArgumentException
&
)
{
{
}
}
}
}
...
@@ -313,12 +374,12 @@ OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, con
...
@@ -313,12 +374,12 @@ OUString CommandInfoProvider::GetCommandProperty(const OUString& rsProperty, con
return
OUString
();
return
OUString
();
}
}
vcl
::
KeyCode
CommandInfoProvider
::
AWTKey2VCLKey
(
const
css
::
awt
::
KeyEvent
&
aAWTKey
)
vcl
::
KeyCode
CommandInfoProvider
::
AWTKey2VCLKey
(
const
awt
::
KeyEvent
&
aAWTKey
)
{
{
bool
bShift
=
((
aAWTKey
.
Modifiers
&
css
::
awt
::
KeyModifier
::
SHIFT
)
==
css
::
awt
::
KeyModifier
::
SHIFT
);
bool
bShift
=
((
aAWTKey
.
Modifiers
&
awt
::
KeyModifier
::
SHIFT
)
==
awt
::
KeyModifier
::
SHIFT
);
bool
bMod1
=
((
aAWTKey
.
Modifiers
&
css
::
awt
::
KeyModifier
::
MOD1
)
==
css
::
awt
::
KeyModifier
::
MOD1
);
bool
bMod1
=
((
aAWTKey
.
Modifiers
&
awt
::
KeyModifier
::
MOD1
)
==
awt
::
KeyModifier
::
MOD1
);
bool
bMod2
=
((
aAWTKey
.
Modifiers
&
css
::
awt
::
KeyModifier
::
MOD2
)
==
css
::
awt
::
KeyModifier
::
MOD2
);
bool
bMod2
=
((
aAWTKey
.
Modifiers
&
awt
::
KeyModifier
::
MOD2
)
==
awt
::
KeyModifier
::
MOD2
);
bool
bMod3
=
((
aAWTKey
.
Modifiers
&
css
::
awt
::
KeyModifier
::
MOD3
)
==
css
::
awt
::
KeyModifier
::
MOD3
);
bool
bMod3
=
((
aAWTKey
.
Modifiers
&
awt
::
KeyModifier
::
MOD3
)
==
awt
::
KeyModifier
::
MOD3
);
sal_uInt16
nKey
=
(
sal_uInt16
)
aAWTKey
.
KeyCode
;
sal_uInt16
nKey
=
(
sal_uInt16
)
aAWTKey
.
KeyCode
;
return
vcl
::
KeyCode
(
nKey
,
bShift
,
bMod1
,
bMod2
,
bMod3
);
return
vcl
::
KeyCode
(
nKey
,
bShift
,
bMod1
,
bMod2
,
bMod3
);
...
...
vcl/source/window/builder.cxx
Dosyayı görüntüle @
d8fc06d2
...
@@ -7,16 +7,7 @@
...
@@ -7,16 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
*/
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
#include <com/sun/star/frame/theUICommandDescription.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/packages/zip/ZipFileAccess.hpp>
#include <com/sun/star/ui/ImageType.hpp>
#include <com/sun/star/ui/XImageManager.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/processfactory.hxx>
#include <osl/module.hxx>
#include <osl/module.hxx>
...
@@ -889,10 +880,6 @@ namespace
...
@@ -889,10 +880,6 @@ namespace
if
(
aCommand
.
isEmpty
())
if
(
aCommand
.
isEmpty
())
return
;
return
;
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
(
comphelper
::
getProcessComponentContext
());
uno
::
Reference
<
frame
::
XModuleManager2
>
xModuleManager
(
frame
::
ModuleManager
::
create
(
xContext
));
OUString
aModuleId
(
xModuleManager
->
identify
(
rFrame
));
OUString
aLabel
(
vcl
::
CommandInfoProvider
::
Instance
().
GetLabelForCommand
(
aCommand
,
rFrame
));
OUString
aLabel
(
vcl
::
CommandInfoProvider
::
Instance
().
GetLabelForCommand
(
aCommand
,
rFrame
));
if
(
!
aLabel
.
isEmpty
())
if
(
!
aLabel
.
isEmpty
())
pButton
->
SetText
(
aLabel
);
pButton
->
SetText
(
aLabel
);
...
@@ -901,7 +888,7 @@ namespace
...
@@ -901,7 +888,7 @@ namespace
if
(
!
aTooltip
.
isEmpty
())
if
(
!
aTooltip
.
isEmpty
())
pButton
->
SetQuickHelpText
(
aTooltip
);
pButton
->
SetQuickHelpText
(
aTooltip
);
Image
aImage
(
VclBuilder
::
getCommandImage
(
aCommand
,
/* bLarge = */
false
,
xContext
,
rFrame
,
aModuleId
));
Image
aImage
(
vcl
::
CommandInfoProvider
::
Instance
().
GetImageForCommand
(
aCommand
,
/*bLarge=*/
false
,
rFrame
));
pButton
->
SetModeImage
(
aImage
);
pButton
->
SetModeImage
(
aImage
);
pButton
->
SetCommandHandler
(
aCommand
);
pButton
->
SetCommandHandler
(
aCommand
);
...
@@ -2169,65 +2156,6 @@ void VclBuilder::reorderWithinParent(std::vector<vcl::Window*>& rChilds, bool bI
...
@@ -2169,65 +2156,6 @@ void VclBuilder::reorderWithinParent(std::vector<vcl::Window*>& rChilds, bool bI
}
}
}
}
Image
VclBuilder
::
getCommandImage
(
const
OUString
&
rCommand
,
bool
bLarge
,
const
uno
::
Reference
<
uno
::
XComponentContext
>&
rContext
,
const
uno
::
Reference
<
frame
::
XFrame
>&
rFrame
,
const
OUString
&
rModuleId
)
{
if
(
rCommand
.
isEmpty
())
return
Image
();
sal_Int16
nImageType
(
ui
::
ImageType
::
COLOR_NORMAL
|
ui
::
ImageType
::
SIZE_DEFAULT
);
if
(
bLarge
)
nImageType
|=
ui
::
ImageType
::
SIZE_LARGE
;
try
{
uno
::
Reference
<
frame
::
XController
>
xController
(
rFrame
->
getController
());
uno
::
Reference
<
frame
::
XModel
>
xModel
(
xController
->
getModel
());
uno
::
Reference
<
ui
::
XUIConfigurationManagerSupplier
>
xSupplier
(
xModel
,
uno
::
UNO_QUERY
);
if
(
xSupplier
.
is
())
{
uno
::
Reference
<
ui
::
XUIConfigurationManager
>
xDocUICfgMgr
(
xSupplier
->
getUIConfigurationManager
(),
uno
::
UNO_QUERY
);
uno
::
Reference
<
ui
::
XImageManager
>
xDocImgMgr
(
xDocUICfgMgr
->
getImageManager
(),
uno
::
UNO_QUERY
);
uno
::
Sequence
<
uno
::
Reference
<
graphic
::
XGraphic
>
>
aGraphicSeq
;
uno
::
Sequence
<
OUString
>
aImageCmdSeq
{
rCommand
};
aGraphicSeq
=
xDocImgMgr
->
getImages
(
nImageType
,
aImageCmdSeq
);
uno
::
Reference
<
graphic
::
XGraphic
>
xGraphic
=
aGraphicSeq
[
0
];
Image
aImage
(
xGraphic
);
if
(
!!
aImage
)
return
aImage
;
}
}
catch
(
uno
::
Exception
&
)
{
}
try
{
uno
::
Reference
<
ui
::
XModuleUIConfigurationManagerSupplier
>
xModuleCfgMgrSupplier
(
ui
::
theModuleUIConfigurationManagerSupplier
::
get
(
rContext
));
uno
::
Reference
<
ui
::
XUIConfigurationManager
>
xUICfgMgr
(
xModuleCfgMgrSupplier
->
getUIConfigurationManager
(
rModuleId
));
uno
::
Sequence
<
uno
::
Reference
<
graphic
::
XGraphic
>
>
aGraphicSeq
;
uno
::
Reference
<
ui
::
XImageManager
>
xModuleImageManager
(
xUICfgMgr
->
getImageManager
(),
uno
::
UNO_QUERY
);
uno
::
Sequence
<
OUString
>
aImageCmdSeq
{
rCommand
};
aGraphicSeq
=
xModuleImageManager
->
getImages
(
nImageType
,
aImageCmdSeq
);
uno
::
Reference
<
graphic
::
XGraphic
>
xGraphic
(
aGraphicSeq
[
0
]);
return
Image
(
xGraphic
);
}
catch
(
uno
::
Exception
&
)
{
}
return
Image
();
}
void
VclBuilder
::
collectPangoAttribute
(
xmlreader
::
XmlReader
&
reader
,
stringmap
&
rMap
)
void
VclBuilder
::
collectPangoAttribute
(
xmlreader
::
XmlReader
&
reader
,
stringmap
&
rMap
)
{
{
xmlreader
::
Span
span
;
xmlreader
::
Span
span
;
...
...
vcl/source/window/toolbox2.cxx
Dosyayı görüntüle @
d8fc06d2
...
@@ -40,12 +40,6 @@
...
@@ -40,12 +40,6 @@
#include <unotools/confignode.hxx>
#include <unotools/confignode.hxx>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
using
namespace
vcl
;
using
namespace
vcl
;
using
namespace
com
::
sun
::
star
;
using
namespace
com
::
sun
::
star
;
...
@@ -603,13 +597,9 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText,
...
@@ -603,13 +597,9 @@ void ToolBox::InsertItem( sal_uInt16 nItemId, const OUString& rText,
void
ToolBox
::
InsertItem
(
const
OUString
&
rCommand
,
const
uno
::
Reference
<
frame
::
XFrame
>&
rFrame
,
ToolBoxItemBits
nBits
,
const
Size
&
rRequestedSize
,
sal_uInt16
nPos
)
void
ToolBox
::
InsertItem
(
const
OUString
&
rCommand
,
const
uno
::
Reference
<
frame
::
XFrame
>&
rFrame
,
ToolBoxItemBits
nBits
,
const
Size
&
rRequestedSize
,
sal_uInt16
nPos
)
{
{
uno
::
Reference
<
uno
::
XComponentContext
>
xContext
(
comphelper
::
getProcessComponentContext
());
uno
::
Reference
<
frame
::
XModuleManager2
>
xModuleManager
(
frame
::
ModuleManager
::
create
(
xContext
));
OUString
aModuleId
(
xModuleManager
->
identify
(
rFrame
));
OUString
aLabel
(
vcl
::
CommandInfoProvider
::
Instance
().
GetLabelForCommand
(
rCommand
,
rFrame
));
OUString
aLabel
(
vcl
::
CommandInfoProvider
::
Instance
().
GetLabelForCommand
(
rCommand
,
rFrame
));
OUString
aTooltip
(
vcl
::
CommandInfoProvider
::
Instance
().
GetTooltipForCommand
(
rCommand
,
rFrame
));
OUString
aTooltip
(
vcl
::
CommandInfoProvider
::
Instance
().
GetTooltipForCommand
(
rCommand
,
rFrame
));
Image
aImage
(
VclBuilder
::
getCommandImage
(
rCommand
,
(
GetToolboxButtonSize
()
==
TOOLBOX_BUTTONSIZE_LARGE
),
xContext
,
rFrame
,
aModuleId
));
Image
aImage
(
vcl
::
CommandInfoProvider
::
Instance
().
GetImageForCommand
(
rCommand
,
(
GetToolboxButtonSize
()
==
TOOLBOX_BUTTONSIZE_LARGE
),
rFrame
));
// let's invent an ItemId
// let's invent an ItemId
const
sal_uInt16
COMMAND_ITEMID_START
=
30000
;
const
sal_uInt16
COMMAND_ITEMID_START
=
30000
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment